package com.pi.config;

import com.pi.pro.xcmg.am.was.fac.LicenseInterceptor;
import com.pi.pro.xcmg.am.was.fac.service.LicenseService;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 *
 */
//@Configuration
public class LicenseWebConfig implements WebMvcConfigurer {

    @Autowired
    private RedissonClient redissonClient;
    @Autowired
    private LicenseService licenseService;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LicenseInterceptor(this.redissonClient, this.licenseService)).addPathPatterns("/**"); // 对所有路径生效
    }
}
